<template>
    <div class="page">
        <el-pagination
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange"
            :current-page="currentPage"
            :page-sizes="pageSizes"
            :page-size="pageSize"
            layout="total, sizes, prev, pager, next, jumper"
            :total="total">
        </el-pagination>
  </div>
</template>

<script>
export default {
    props:{
        //每页展示多少数据量
        pageSizes:{
            type: Array,
            default: ()=> [10,20,50,100]
        },
        //当前选中的每页大小
        pageSize:{
            type: Number,
            default: 10
        },
        //数据总条数
        total:{
            type: Number,
            default: 0
        },
        //当前页
        currentPage:{
            type: Number,
            default:1
        }
    },
    methods:{
        //每页展示大小发生变化
        handleSizeChange(val) {
            this.$emit('pageSizeChange',val)
        },
        //页面跳转
        handleCurrentChange(val) {
            this.$emit('currentPageChange',val)
        }
    }
}
</script>

<style lang="scss" scoped>
    .page::v-deep{
        display: flex;
        flex-direction: row;
        justify-content: center;
        align-items: center;
        margin-top: 18px;
    }
</style>